<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var age = prompt("请输入您的年龄!!!");
        age = +age;
        console.log(age)
        if(age||age==0){
            if(age == 0){
            alert("亲,年龄不能为0哦!");
        }else if( 0 < age && age < 14){
            alert("您是儿童");
        }else if(age >= 14 && age < 24){
            alert("您是青少年");
        }else if(age >= 24 && age < 40){
            alert("您是青年");
        }else if(age >= 40 && age < 60){
            alert("您是中年");
        }else if (age >= 60){
            alert("您是老年");
        }
        }else{
            alert("请输入正确的年龄");
            location.reload();
        }
    </script>
</body>
</html>